package cst.a220tbc.layouttest;

import android.content.DialogInterface;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity implements View.OnClickListener{
    private EditText Input;
    private TextView ShowInput;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout4);
        Input = (EditText) findViewById(R.id.Input);
        ShowInput = (TextView) findViewById(R.id.showInput) ;
        findViewById(R.id.button).setOnClickListener(this);
        findViewById(R.id.button2).setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.button:
                Input.setText("");
            case R.id.button2:
                ShowInput.setText(Input.getText().toString());
                Toast.makeText(MainActivity.this, "类容是"+ShowInput.getText(), Toast.LENGTH_SHORT).show();
                break;
            default:
                break;
        }
    }
}
